<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img :src="this.bannerImg" alt class="banner-img">
      <div class="banner-info">
        <div class="banner-title">{{ this.sightName }}</div>
        <div class="banner-icon">
          <span class="iconfont icon-banner">&#xe620;</span>
          {{this.gallaryImg.length}}
        </div>
      </div>
    </div>  
    <Fade>
      <Gallery :imgs="gallaryImg" v-show="flag" @gallaryClose="gallaryClose"></Gallery>
    </Fade>
  </div>
</template>
<script>
import Gallery from "common/Gallery/Gallery.vue";
import Fade from "common/Fade/Fade.vue";
export default {
  mounted() {
    console.log(this.gallaryImg);
  },
  components: {
    Gallery,
    Fade
  },
  data() {
    return {
      // imgs: [
      //   "http://img1.qunarzz.com/sight/p27/201211/06/0932693bbebc5cf293835fbb.jpg_r_800x800_37535a26.jpg",
      //   "http://img1.qunarzz.com/sight/p0/201305/16/553bd995fa8c15d1c8d65eac.jpg_r_800x800_61637203.jpg"
      // ],
      flag: false
    };
  },
  methods: {
    gallaryClose() {
      this.flag = false;
    },
    handleBannerClick() {
      this.flag = true;
    }
  },
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImg: Array
  }
};
</script>
<style lang="stylus" scoped>
.banner {
  position: relative;
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;
  width: 100%;

  .banner-img {
    width: 100%;
  }

  .banner-info {
    display: flex;
    justify-content: space-between;
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    color: #fff;
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));

    .banner-title {
      font-size: 0.32rem;
      padding: 0.2rem;
    }

    .banner-icon {
      margin-top: 0.2rem;
      background-color: rgba(0, 0, 0, 0.3);
      padding-right: 0.2rem;
      height: 0.32rem;
      line-height: 0.32rem;
      font-size: 0.24rem;

      .icon-banner {
        font-size: 0.24rem;
      }
    }
  }
}
</style>